define(function(require, exports){
	exports.onChk = function(controller, data, app){
		var user = app.getUser();
		if(!user || !app.isLogin()) {
			if (data && data.param) {
				var ticket = data.param;
				app.mc.send('/login', {ticket: ticket, host: window.location.host}, function (err, data) {
					if (err || !data || !data.state) {
						app.alert(err ? err.message : LANG("管理员登录失败"));
						app.controller.navigate(-2);
					} else {
						// 登录成功，跳
						app.controller.navigate(app.config('site_base'));
						window.location.reload();
					}
				});
			} else {
				app.alert(LANG("无效链接, 管理员登录失败"));
				app.controller.navigate(-2);
			}
		}else if(app.isLogin()) {
			app.controller.navigate(app.config('site_base'));
		}else{
			app.controller.navigate(-2);
		}
	};
});
